﻿<common:LayoutAwarePage
    x:Name="pageRoot"
    x:Class="HAP.Win.MyFiles.Details"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:HAP.Win.MyFiles"
    xmlns:common="using:HAP.Win.MyFiles.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <common:LayoutAwarePage.Resources>
        <ResourceDictionary>
            <local:ImageUriConverter x:Key="ImageUriConverter"/>
        </ResourceDictionary>
    </common:LayoutAwarePage.Resources>
    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <ProgressBar Name="loading" Background="Transparent" IsIndeterminate="False" />
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <Image Source="{Binding Icon, Converter={StaticResource ResourceKey=ImageUriConverter}}" Width="64" Height="64" Grid.Column="1" VerticalAlignment="Bottom" Margin="30,0,30,30" />
            <TextBlock x:Name="pageTitle" Text="Loading..." Style="{StaticResource PageHeaderTextStyle}" Grid.Column="3" IsHitTestVisible="false"/>
        </Grid>
        <Grid Grid.Row="2" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="138,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="20" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="16" />
                <RowDefinition />
                <RowDefinition Height="4" />
                <RowDefinition />
                <RowDefinition Height="16" />
                <RowDefinition />
                <RowDefinition Height="4" />
                <RowDefinition />
                <RowDefinition Height="4" />
                <RowDefinition />
                <RowDefinition Height="40" />
                <RowDefinition Height="10" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock Text="Type of file: " FontSize="16" />
            <TextBlock Text="{Binding Type}" Grid.Column="3" FontSize="16" />
            <TextBlock Text="Location: " Grid.Row="2" FontSize="16" />
            <TextBlock Text="{Binding Location}" Grid.Row="2" Grid.Column="3" FontSize="16" />
            <TextBlock Text="Size: " Grid.Row="4" FontSize="16" />
            <TextBlock Text="{Binding Size}" Grid.Row="4" Grid.Column="3" FontSize="16" />
            <TextBlock Text="Created: " Grid.Row="6" FontSize="16" />
            <TextBlock Text="{Binding DateCreated}" Grid.Row="6" Grid.Column="3" FontSize="16" />
            <TextBlock Text="Modified: " Grid.Row="8" FontSize="16" />
            <TextBlock Text="{Binding DateModified}" Grid.Row="8" Grid.Column="3" FontSize="16" />
            <TextBlock Text="Accessed: " Grid.Row="10" FontSize="16" />
            <TextBlock Text="{Binding DateAccessed}" Grid.Row="10" Grid.Column="3" FontSize="16" />
            <ProgressBar Grid.Row="11" Grid.ColumnSpan="3" Name="pro" Width="400" Height="16" VerticalAlignment="Bottom" Visibility="Collapsed"/>
            <Button Content="Download" Name="downloadbutton" Grid.Row="13" Grid.ColumnSpan="3" FontSize="30" Click="downloadbutton_Click" />
        </Grid>
        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The back button respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!-- The back button and title have different styles when snapped -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>
